Thats Ok ,i have an old enmity against pointers
...Still this wont stop me asking a question ,
As per your advice i changed the code and it works perfectly and the change is as follow
localRectItem
= addRect
(0,
0,rectWidth,rectHeight,
QPen(),Qt
::NoBrush);
localRectItem->setPos(startX,startY);
rectItem.append(localRectItem);
localRectItem = addRect(0,0,rectWidth,rectHeight,QPen(),Qt::NoBrush);
localRectItem->setPos(startX,startY);
rectItem.append(localRectItem);
To copy to clipboard, switch view to plain text mode
while the previous not-so-good code was
rectItem << addRect
(0,
0,rectWidth,rectHeight,
QPen(),Qt
::NoBrush);
rectItem.at(number)->setPos(startX,startY);
rectItem << addRect(0,0,rectWidth,rectHeight,QPen(),Qt::NoBrush);
rectItem.at(number)->setPos(startX,startY);
To copy to clipboard, switch view to plain text mode
What makes these two pieces of code so different that if i use the second code then i cant declare rectItem as a class variable ...i cant absorb this fact...
I won't give you a lecture here on how pointers work
May be one line answer for that or few line detailed answer is good too..No lectures please.!..
..
Bookmarks